package GUI;
import processing.core.PImage;
import processing.core.PImage;

public class IconMiniButton extends Component
{
	public boolean clicked;
	public boolean pressed;
	public String name;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	public IconMiniButton()
	{
		width = 35;
		height = 35;
	}
	
	public void setIcon(String name)
	{
		if(name != null)
		{
			icon = Utils.globalProcessing.loadImage(name);
		}
	}
	
	public void draw()
	{
		clicked = false;
		int cx = x;
		int cy = y;
		if(mouseOver()) 
		{
			if(Utils.globalProcessing.mousePressed)
			{
				pressed = true;
			}
			else if(pressed)
			{
				pressed = false;
				clicked = true;
			}
		}
		else
		{
			pressed = false;
		}
		if(icon != null)
		{
			Utils.globalProcessing.image(icon, cx, cy,35,35);
		}
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////
	PImage icon;
}